package p2pserver
{
	import flash.events.NetStatusEvent;
	import flash.net.NetConnection;
	import flash.net.NetGroup;
	
	import flashx.textLayout.elements.BreakElement;
	
	public class P2pNetGroup extends NetGroup
	{
		private var netGroupEventProcess:IP2pNetGroupEventProcess;
		private var postingNofity:Function = null;
		
		public function P2pNetGroup(connection:NetConnection, groupspec:String,
									netGroupEventProcess:IP2pNetGroupEventProcess)
		{
			super(connection, groupspec);
			
			this.netGroupEventProcess =netGroupEventProcess;
			
			this.addEventListener(NetStatusEvent.NET_STATUS, NetStatus);
		}
		
		protected function PostingNotify(event:NetStatusEvent):void{
			
				netGroupEventProcess.onNetGroupPostingNofity(event);	
		}
		
		private function NetStatus(event:NetStatusEvent):void{
			trace(event.info.code);				
			switch(event.info.code){
				case "NetGroup.Posting.Notify":
					PostingNotify(event);
					break;
				
				default:
					break;
			}
		}
	}
}